package org.sys.transporttrainsys.service;

import org.sys.transporttrainsys.entity.Consultation;
import org.sys.transporttrainsys.repository.ConsultationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsultationService {

    @Autowired
    private ConsultationRepository consultationRepository;

    public List<Consultation> findAll() {
        return consultationRepository.findAll();
    }

    public Consultation findById(Long id) {
        return consultationRepository.findById(id).orElse(null);
    }


    public Consultation save(Consultation consultation) {
        return consultationRepository.save(consultation);
    }

    public void deleteById(Long id) {
        consultationRepository.deleteById(id);
    }

    public List<Consultation> findByTitle(String title) {
        return consultationRepository.findByTitle(title);
    }

    public List<Consultation> findByStatus(String status) {
        return consultationRepository.findByStatus(status);
    }

    public List<Consultation> findByTitleAndStatus(String title, String status) {
        return consultationRepository.findByTitleAndStatus(title, status);
    }
}